home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_riv_fence.cog < prev    next >
Text File  |  1999-11-15  |  5KB  |  207 lines

  1. # Jones 3D Cog Script
  2. #
  3. # RIV_Fence.cog
  4. #
  5. # [TRM]
  6. #
  7. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  8. #
  9. # ========================================================================================
  10.  
  11. symbols
  12.  
  13.     message     startup
  14.     message     activated
  15.  
  16.     thing       player      local
  17.     thing       fence
  18.     thing       button
  19.     thing       look_Fence
  20.     thing       cam1
  21.     
  22.     sound       snd_Start=bab_gate_start.wav        local
  23.     sound       snd_Moving=bab_gate_move.wav        local
  24.     sound       snd_Stop=bab_gate_stop.wav          local
  25.     sound       snd_Button=gen_wood_button.wav      local
  26.     
  27.     cog         hintCog
  28.     
  29.     # ** subroutines **
  30.     flex        openFence   local
  31.     flex        closeFence  local
  32.     
  33.     int         open=0      local
  34.     int         playing=0   local
  35.     int         track_Move  local
  36.     int         sentOnce=0  local
  37.  
  38. end
  39.  
  40. # ========================================================================================
  41.  
  42. code
  43.  
  44. startup:
  45.  
  46.     SetThingLight(button, '0.25 0.25 0.25', 0.01, 0.5);
  47.     return;
  48.     
  49. # ========================================================================================
  50.  
  51. activated:
  52.  
  53.     player = GetLocalPlayerThing();
  54.     
  55.     if((GetSenderRef() == button) && (open == 0) && (playing == 0))
  56.     {
  57.         playing = 1;
  58.         open = 1;
  59.         Call openFence;
  60.     }
  61.  
  62.     else if((GetSenderRef() == button) && (open == 1) && (playing == 0))
  63.     {
  64.         playing = 1;
  65.         open = 0;
  66.         Call closeFence;
  67.     }
  68.     
  69.     return;
  70.            
  71. # ========================================================================================
  72.  
  73. openFence:
  74.  
  75.     if(sentOnce == 0)
  76.     {
  77.         sentOnce = 1;
  78.         SendMessage(hintCog, user0);
  79.     }
  80.     
  81.     # do cutscene stuff
  82.     MakeMeStop();
  83.     StartCutscene(0);
  84.     
  85.     # switch to external camera
  86.     SetCameraFocus(2, cam1);
  87.     SetCameraSecondaryFocus(2, player);
  88.     SetCurrentCamera(2);
  89.     
  90.     # put away any weapon
  91.     DeselectWeaponWait(player);
  92.     
  93.     PlayMode(player, 60, 0);
  94.     Sleep(0.3);
  95.     
  96.     PlaySoundThing(snd_Button, button, 1.0, 5.0, 10.0, 0);
  97.     MoveToFrame(button, 1, 1.0);
  98.     WaitForStop(button);
  99.     
  100.     # set camera interp speed turn on look interp
  101.     SetCameraInterpSpeed(2, 2.0);
  102.     SetCameraLookInterp(2, 1);
  103.     Sleep(0.01);
  104.     
  105.     # interp to look_Fence
  106.     SetCameraSecondaryFocus(2, look_Fence);
  107.     
  108.     Sleep(1.5);
  109.     
  110.     PlaySoundThing(snd_Start, fence, 1.0, 10.0, 20.0, 0);
  111.     track_Move = PlaySoundThing(snd_Moving, fence, 1.0, 10.0, 20.0, 0);
  112.     MoveToFrame(fence, 1, 2.0);
  113.     WaitForStop(fence);
  114.     StopSound(track_Move, 0.5);
  115.     PlaySoundThing(snd_Stop, fence, 1.0, 10.0, 20.0, 0);
  116.     
  117.     # move camera focus back to player
  118.     SetCameraInterpSpeed(2, 1.0);
  119.     SetCameraSecondaryFocus(2, player);
  120.     
  121.     PlaySoundThing(snd_Button, button, 1.0, 5.0, 10.0, 0);
  122.     MoveToFrame(button, 0, 1.0);
  123.     WaitForStop(button);
  124.     
  125.     Sleep(1.0);
  126.     
  127.     # restore camera to player
  128.     SetCameraPosition(1, GetThingPos(cam1));
  129.     SetCurrentCamera(1);
  130.     
  131.     # turn off look interp
  132.     SetCameraLookInterp(2, 0);
  133.     
  134.     playing = 0;
  135.     
  136.     # return control to player
  137.     ClearActorFlags(player, 0x200000);
  138.     EndCutscene();
  139.     
  140.     return;
  141.  
  142. # ========================================================================================
  143.  
  144. closeFence:
  145.  
  146.     # do cutscene stuff
  147.     MakeMeStop();
  148.     StartCutscene(0);
  149.     
  150.     # switch to external camera
  151.     SetCameraFocus(2, cam1);
  152.     SetCameraSecondaryFocus(2, player);
  153.     SetCurrentCamera(2);
  154.     
  155.     PlayMode(player, 60, 0);
  156.     Sleep(0.3);
  157.     
  158.     PlaySoundThing(snd_Button, button, 1.0, 5.0, 10.0, 0);
  159.     MoveToFrame(button, 1, 1.0);
  160.     WaitForStop(button);
  161.     
  162.     # set camera interp speed turn on look interp
  163.     SetCameraInterpSpeed(2, 2.0);
  164.     SetCameraLookInterp(2, 1);
  165.     Sleep(0.01);
  166.     
  167.     # interp to look_Fence
  168.     SetCameraSecondaryFocus(2, look_Fence);
  169.     
  170.     Sleep(1.5);
  171.     
  172.     PlaySoundThing(snd_Start, fence, 1.0, 10.0, 20.0, 0);
  173.     track_Move = PlaySoundThing(snd_Moving, fence, 1.0, 10.0, 20.0, 0);
  174.     MoveToFrame(fence, 0, 2.0);
  175.     WaitForStop(fence);
  176.     StopSound(track_Move, 0.5);
  177.     PlaySoundThing(snd_Stop, fence, 1.0, 10.0, 20.0, 0);
  178.     
  179.     # move camera focus back to player
  180.     SetCameraInterpSpeed(2, 1.0);
  181.     SetCameraSecondaryFocus(2, player);
  182.     
  183.     PlaySoundThing(snd_Button, button, 1.0, 5.0, 10.0, 0);
  184.     MoveToFrame(button, 0, 1.0);
  185.     WaitForStop(button);
  186.     
  187.     Sleep(1.0);
  188.     
  189.     # restore camera to player
  190.     SetCameraPosition(1, GetThingPos(cam1));
  191.     SetCurrentCamera(1);
  192.     
  193.     # turn off look interp
  194.     SetCameraLookInterp(2, 0);
  195.     
  196.     playing = 0;
  197.     
  198.     # return control to player
  199.     ClearActorFlags(player, 0x200000);
  200.     EndCutscene();
  201.     
  202.     return;
  203.     
  204. # ========================================================================================
  205.  
  206. end
  207.